package com.example.sprinbootdemo.service.impl;

import com.example.sprinbootdemo.entity.Renter;
import com.example.sprinbootdemo.mapper.RenterMapper;
import com.example.sprinbootdemo.service.RenterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RenterServiceImpl implements RenterService {

    @Autowired
    private RenterMapper renterMapper;

    @Override
    public List<Renter> getAllRenters() {
        return renterMapper.selectAll();
    }

    @Override
    public void addRenter(Renter renter) {
        renterMapper.addRenter(renter);
    }

    @Override
    public void deleteRenterById(int renterId) {
        renterMapper.deleteRenterById(renterId);
    }

    @Override
    public void updateRenterById(Renter renter) {
        renterMapper.updateRenterById(renter);
    }

    @Override
    public List<Renter> getRentersByName(String name) {
        return renterMapper.getRentersByName(name);
    }

}